﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace ClickCount
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, INotifyPropertyChanged
    {
        private int clickCount;
        public event PropertyChangedEventHandler PropertyChanged;
        public int ClickCount
        {
            get
            {
                return clickCount;
            }
            set
            {
                clickCount = value;
                OnPropertyChanged("ClickCount");
            }
        }

        public MainWindow()
        {
            InitializeComponent();
            ClickCount = 0;
        }

        private void clickBtn_Click(object sender, RoutedEventArgs e)
        {
            ClickCount += 1;
        }

        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }
     
    }
}
